# Contributor: Andre Bierwolf <a.b.bierwolf@gmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=novnc
pkgver=1.5.0
pkgrel=0
pkgdesc="VNC client using HTML5 (WebSockets, Canvas) with encryption (wss://) support"
url="https://novnc.com/"
arch="noarch"
license="MPL-2.0"
depends="net-tools websockify"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/novnc/noVNC/archive/v$pkgver.tar.gz
	alpine-specific-launch.js.patch
	man-page-rename-novnc_proxy.patch
	"
builddir="$srcdir/noVNC-$pkgver"
options="!check"

package() {
	mkdir -p "$pkgdir"/usr/share/$pkgname
	cd "$pkgdir"/usr/share/$pkgname
	cp -r "$builddir"/* .

	# Move license files.
	mkdir -vp "$pkgdir"/usr/share/licenses/$pkgname
	mv -v LICENSE.txt docs/LICENSE.* "$pkgdir"/usr/share/licenses/$pkgname/

	# Move documentation and man page.
	mkdir -vp "$pkgdir"/usr/share/doc "$pkgdir"/usr/share/man/man1
	mv -v docs/novnc_proxy.1 "$pkgdir"/usr/share/man/man1/novnc_server.1
	mv -v docs "$pkgdir"/usr/share/doc/$pkgname
	mv -v README.md "$pkgdir"/usr/share/doc/$pkgname/

	# Install launch.sh to /usr/bin.
	install -Dvm755 utils/novnc_proxy "$pkgdir"/usr/bin/novnc_server

	# Remove irrelevant utils.
	rm -rv utils
}

sha512sums="
36977cde835697bec8547493e47be2ce78e4a748a29c249ce1f36df6c0e238aaacaddcb116efd484119c832a3d43e6ef12cff1c0e0a1179755ae43ed49b7fd09  novnc-1.5.0.tar.gz
4a244523553d838318d7160476a7c133b927ee0088d63bc0d5506f128bb31d1462f24dadf724b12e8bcc757021a3b3989dee25064fd87c5f37ea2fef2b6e35d5  alpine-specific-launch.js.patch
e765c2981348e6f24810c3201810b8275ed9c850dbda9830e2b6f9983573a809b728597e9798bb69e8e6ccfc2a5c15b78592b23e5b8baf6674f7af38da871af2  man-page-rename-novnc_proxy.patch
"
